package com.example.perplonews.a_a_mvp.presenter.presenters

import BasePresenter
import com.example.perplonews.a_a_mvp.contract.News_Contract
import com.example.perplonews.a_a_mvp.model.HttpCode
import com.example.perplonews.a_b_entity.BaseEntity
import com.example.perplonews.a_b_utils.LjlUtils
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers

class News_Presenter(model: News_Contract.NewsModel, view: News_Contract.NewsView) :
    BasePresenter<News_Contract.NewsModel, News_Contract.NewsView>(model, view) {

    private var page = 1
    fun requestAll(list: ArrayList<HashMap<String, Any>>) {

        mymodel.requestAll(list)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(this)
    }

    override fun onNext(t: BaseEntity) {
        if (t.status.equals("200")) {

        } else {
            LjlUtils.Ljl_Loge(
                "----News_Presenter" + t.message

            )
        }

        myview.refreshAll(t)

    }


}